function open(stepDiv, title, url, step) {
    $(stepDiv).removeClass().addClass("lc_selected");
    $(stepDiv).parent().siblings().children('div').removeClass().addClass("lc_default");
    qBox.Close();
    qBox.iFLoad({title:title,
        src:url + "?transType="
            + $("#transType").val() + '&transId=' + $("#transId").val()
            + '&mainWorkflowStep=' + step,
        scrolling:'yes',
        w:$("#content").width() - 10, h:$(document).height() - $("#content").height() - 55,
        x:$("#content").offset().left, y:$("#content").offset().top + $("#content").height()});
}

function getStatusColor(status) {
    if (status == 'Finished') {
        return 'finish';
    } else if (status == 'Underway') {
        return 'going';
    }
}

function showMainWorkflowChart(transType, transId,workflowId,globalFlag) {

    jQuery.ajax({url:ctx + "/workflow/workflowChart/getMainWorkflow.action",
        type:"POST",
        global:globalFlag != undefined ? globalFlag :false,
        data:{ 'transType':transType,
            'transId':transId,
            'workflowId':workflowId != null ? workflowId : ''
        },
        success:function (mainWorkflowInfo) {
            for(var mainWorkStep in mainWorkflowInfo){
                var mainWorkStepDiv = $("#"+mainWorkStep).parent();
                $("#"+mainWorkStep).attr("status",mainWorkflowInfo[mainWorkStep]);
                if (mainWorkStepDiv.hasClass("finish")) {
                    mainWorkStepDiv.removeClass("finish").addClass(getStatusColor(mainWorkflowInfo[mainWorkStep]));
                } else if (mainWorkStepDiv.hasClass("going")) {
                    mainWorkStepDiv.removeClass("going").addClass(getStatusColor(mainWorkflowInfo[mainWorkStep]));
                } else {
                    mainWorkStepDiv.addClass(getStatusColor(mainWorkflowInfo[mainWorkStep]));
                }
            }
        }
    });
}